<script type="text/javascript">
$().ready(function() {

	function findValueCallback(event, data, formatted) {
		$("<li>").html( !data ? "No match!" : "Selected: " + formatted).appendTo("#result");
	}

	function formatItem(row) {
            $return="";
            var dim = row.length;
            for(val in row){
                $return = $return+row[val];
                if(val<dim-1){
                    $return = $return+" ";
                }
            }
            return $return;
	}
	function formatResult(row) {
            $return="";
            var dim = row.length;
            for(val in row){
                $return = $return+row[val].replace(/(<.+?>)/gi, '');
                if(val<dim-1){
                    $return = $return+" ";
                }
            }
            return $return;
	}

	$("#recherche").autocomplete("utilities/tag.php", {
		width: 260,
        	selectFirst: false,
                formatItem: formatItem,
		formatResult: formatResult
	});
});
</script>

<?php

    echo <<<END
<div class="formRecherche">
    <form action="index.php" method="get">
        <input type="hidden" name="page" value="listVideos"/>
        <input type="hidden" name="order" value="{$_GET['order']}"/>
        <input type="hidden" name="evenement" value="{$_GET['evenement']}"/>
        <input type="hidden" name="categorie" value="{$_GET['categorie']}"/>
        <input type="text" id="recherche" name="recherche" value="{$_GET['recherche']}"/>
        <input type="submit" value="Recherche"/>
    </form>
</div>
END;

?>
